package IOperation;

import BOOK.Book;
import BOOK.BookList;

import java.util.Scanner;

/**
 * Created with IntelliJ IDEA.
 * User: wenxiwen
 * Date: 2022/4/14
 * Time: 20:30
 * Description: No Description
 */
public class Add implements IOperation{

    public void work(BookList bookList) {
        System.out.println("新增图书");

        Scanner scan = new Scanner(System.in);
        System.out.println("请输入书籍名称：");
        String name = scan.nextLine();
        System.out.println("请输入书籍的作者：");
        String author = scan.nextLine();
        System.out.println("请输入书籍的类型：");
        String type = scan.nextLine();
        System.out.println("请输入书籍的价格：");
        int price = scan.nextInt();
        Book book = new Book(name,author,type,price);
        int index = bookList.getCount();
        bookList.setBook(index,book);
        bookList.setCount(index+1);
        System.out.println("添加成功！");
    }
}